
$(mailist)
function refresh(){
	mailist();
}
var psid = param.psid;
var dataHand = new AjaxHandler();
var id=param.mailid;
 var usersel = param.usersel;
if(usersel=="setuser"){
	$(".submit-btn").show();
	
}
function mailist(){
	$.proAjax({
		url: "/mobile/findEmail",
		data: {"id":id},
		success: function (data) {
			for(var key in data){
				$("#"+key).val(data[key]);
			}
			if(usersel=="setuser"){ 
				$(".submit-btn").show();
				$("input").removeAttr("readonly");
				$("textarea").removeAttr("readonly");
			}else{
				$(".submit-btn").hide();
				$("input").attr("readonly","readonly");
				$("textarea").attr("readonly","readonly");
			}
			
		}
	})
}
function savemail(){
	var pname = $("#pname").val();
	var psname = $("#psname").val();
	var array = ["请填写姓名","请选取电站名称"];
	if(pname=="") {
		mui.alert(array[0],"提示","确定",function(){
			$("#pname").focus();
		});
		return;
	}
	if(psname=="") {
		mui.alert(array[1],"提示","确定",function(){
			$("#psname").focus();
		});
		return;
	}
	var mail=$param();
	$.proAjax({
		url: "/mobile/saveEmail",
		data: mail,
		success: function (data) {
			try{
				var  detailPage = plus.webview.getWebviewById("tongxunEdit");
				mui.fire(detailPage,'refresh',param);
			}catch(e){
				
			}
			$(".submit-btn").hide();
			$("input").attr("readonly","readonly");
			$("textarea").attr("readonly","readonly");
			//router.href("tongxunEdit.html",{mailid:"",usersel:""});
			mui.back();
			}
	})
}


